import http from "./http";
//登录
export const Login = (data) => {
  return http.request({
    url: "/user/login",
    method: "POST",
    data: {
      studentIdOrEmail: data.account,
      password: data.password,
    },
  });
};
//获取邮箱验证码
export const sendCode = (data) => {
  return http.request({
    url: `/email/send?email=${data}`,
    method: "POST",
  });
};
//注册
export const Register = (data) => {
  return http.request({
    url: "/user/register",
    method: "POST",
    data: {
      identity: data?.identity,
      studentId: data?.username,
      username: data?.name,
      email: data?.email,
      emailCode: data?.code,
      password: data?.password,
    },
  });
};
//微信登录
export const WXLogin = (data) => {
  return http.request({
    url: `/wx/login?code=${data}`,
    method: "POST",
  });
};
//忘记密码
export const ForgetPassword = (data) => {
  return http.request({
    url: "/user/forget-password",
    method: "POST",
    data: {
      studentId: data.username,
      email: data.email,
      code: data.code,
      password: data.password,
    },
  });
};
